﻿$(document).ready(function () {
    GetOnlineUsersList();
});
function GetOnlineUsersList() {
    $.ajax({
        type: "post",
        url: "/Account/GetOnlineUsers",
        success: function (result) {
            var userList = result.Result;
            $('.onlineUsers').html('');
            var newChatWindow = '';
            jQuery.each(userList, function (i, userList) {
                newChatWindow += " <div >" +
                    "<a href=# id=\"" + userList.ID + "_" + userList.FirstName + "\" class=\"chat-window\">" + userList.FirstName + " " + userList.LastName + "</a>" +
                "</div>";
            });
            if (newChatWindow == '') {
                newChatWindow += " <div id=\"offLine\"> No one is online" +

                "</div>";
            }
            $('.onlineUsers').html(newChatWindow);
        }
    });
}